package com.shqcjd.sinopecdemomobile.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.model.pojo.DefectManageBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class DefectManageAdapter extends BaseQuickAdapter<DefectManageBean.ListBean, DefectManageAdapter.ViewHolder> {
    private Context context;

    public DefectManageAdapter(@Nullable List<DefectManageBean.ListBean> data, Context context) {
        super(R.layout.item_equipment_info_defect, data);
        this.context = context;
    }

    @Override
    protected void convert(ViewHolder helper, DefectManageBean.ListBean item) {
        helper.tvItemEquipmentDefectName.setText(item.equipmentName);
        helper.tvItemEquipmentDefectState.setText("("+item.state+")");
        helper.tvItemEquipmentDefectType.setText(item.equipmentTypeName);
        helper.tvItemEquipmentDefectInfo.setText("● 缺陷说明: "+item.description);
        helper.tvItemEquipmentDefectStart.setText("发现时间: "+item.discoveryTime);
        helper.tvItemEquipmentDefectEnd.setText("结束时间: "+item.resolveTime);
    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.tv_item_equipment_defect_name)
        TextView tvItemEquipmentDefectName;
        @BindView(R.id.tv_item_equipment_defect_state)
        TextView tvItemEquipmentDefectState;
        @BindView(R.id.tv_item_equipment_defect_type)
        TextView tvItemEquipmentDefectType;
        @BindView(R.id.tv_item_equipment_defect_info)
        TextView tvItemEquipmentDefectInfo;
        @BindView(R.id.tv_item_equipment_defect_end)
        TextView tvItemEquipmentDefectEnd;
        @BindView(R.id.tv_item_equipment_defect_start)
        TextView tvItemEquipmentDefectStart;
        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
